<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="tag" uri="http://www.springframework.org/tags"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%>

<security:authorize access="isAuthenticated()">

<div id="userProfile">
	<div class="profile">
	
		<div class="userProfile" style="display: inline;">
	
			
			<div class="avatar" style="float: left;">
				<a href="#/user/<c:out value="${selectedUser.username }"></c:out>">
					<img src="/resources/css/img/default-avatar.png" alt="avatar" />
				</a>
			</div>
			<div style="float: left;">
				<h2><c:out value="${selectedUser.username }"></c:out></h2>
				<p><b><spring:message code="friends.label.username"/>:</b> <c:out value="${selectedUser.username }"></c:out> </p>
				<p><b><spring:message code="friends.label.firstname"/>:</b> <c:out value="${selectedUser.userAdditionalInformations.firstName }"></c:out> </p>
				<p><b><spring:message code="friends.label.lastname"/>:</b> <c:out value="${selectedUser.userAdditionalInformations.lastName }"></c:out> </p>
				<p><b><spring:message code="friends.label.birthday"/>:</b> <c:out value="${selectedUser.userAdditionalInformations.birthday }"></c:out> </p>
				<br>
				<p><b><spring:message code="friends.label.joindate"/>:</b> <fmt:formatDate value="${selectedUser.createdDate }" type="date" pattern="dd-MMMMMMMMMMMMMMMM-yyyy"/></p>
			</div>
		</div>
		<div style="clear:both"></div>
		<div class="buttons">
			<div class="button">
				<div>
					<a class="inviteFriend"><spring:message code="friends.label.invite"/></a>
				</div>
			</div>
			<div style="clear:both"></div>
		</div>

	</div>
</div>

<script type="text/javascript">

$(".inviteFriend").click(function(){
	var friend = '<c:out value="${selectedUser.username }"/>';
	Api.me.inviteFriend(friend, function(){
		alert("sukces");
	}, 
	function(){
		alert("error");
		});
});
</script>
</security:authorize>
